{{- $params := .Scratch.Get "params" -}}
{{- $gitRepo := (strings.TrimSuffix "/" .Site.Params.gitRepo) -}}

<div class="post-footer" id="post-footer">
  <div class="post-info">
    <div class="post-info-line">
      <div class="post-info-mod">
        <span title="{{ dict "Date" ("2006-01-02 15:04:05" | .Lastmod.Format) | T "single.updatedOnDate" }}">
          {{- with .Site.Params.dateformat | default "2006-01-02" | .Lastmod.Format -}}
            {{- dict "Date" . | T "single.updatedOnDate" -}}&nbsp;
            {{- if $gitRepo -}}
              {{- with $.GitInfo -}}
                <a class="git-hash" href="{{ printf `%v/commit/%v` $gitRepo .Hash }}" rel="external nofollow noopener noreferrer" target="_blank" title="commit by {{ .AuthorName }}({{ .AuthorEmail }}) {{ .Hash }}: {{ .Subject }}">
                  {{- dict "Class" "fa-solid fa-hashtag fa-fw" | partial "plugin/icon.html" -}}
                  {{- .AbbreviatedHash -}}
                </a>
              {{- end -}}
            {{- end -}}
          {{- end -}}
        </span>
      </div>
      {{- with $params.license | string -}}
        <div class="post-info-license{{ with $params.password }} d-none{{ end }}">
          <span>{{- . | safeHTML -}} </span>
        </div>
      {{- end -}}
    </div>
    <div class="post-info-line{{ with $params.password }} d-none{{ end }}">
      <div class="post-info-md">
        {{- if $params.linktomarkdown -}}
          {{- with .OutputFormats.Get "markdown" -}}
            <span>
              {{- $options := dict "Class" "link-to-markdown" "Destination" .RelPermalink "Title" (T "single.readMarkdown") "Content" (T "single.readMarkdown") "externalIcon" false -}}
              {{- partial "plugin/link.html" $options -}}
            </span>
          {{- end -}}
        {{- end -}}
        {{- with $params.edit -}}
          {{- if .Enable -}}
            <span>
              {{- $editUrl := printf "%v/%v" (strings.TrimSuffix "/" .Url) $.File.Path -}}
              {{- if not (hasPrefix $editUrl "http") -}}
                {{- $editUrl = printf "%v/%v" $gitRepo (strings.TrimPrefix "/" $editUrl) -}}
              {{- end -}}
              {{- $options := dict "Class" "link-to-edit" "Destination" $editUrl "Title" (T "single.editThisPage") "Content" (T "single.editThisPage") "externalIcon" false -}}
              {{- partial "plugin/link.html" $options -}}
            </span>
          {{- end -}}
        {{- end -}}
      </div>
      <div class="post-info-share">
        <span>
          {{- partial "plugin/share.html" . -}}
        </span>
      </div>
    </div>
  </div>

  <div class="post-info-more">
    <section class="post-tags">
      {{- with .Params.tags -}}
        {{- dict "Class" "fa-solid fa-tags fa-fw me-1" | partial "plugin/icon.html" -}}
        {{- range $value := . -}}
          {{- $tag := partialCached "function/path.html" $value $value | printf "/tags/%v" | $.Site.GetPage -}}
          {{- with $tag -}}
            <a href='{{ partial "function/escapeurl.html" .RelPermalink }}' class="post-tag">{{ .Title }}</a>
          {{- end -}}
        {{- end -}}
      {{- end -}}
    </section>
    <section>
      <span><a href="javascript:void(0);" onclick="window.history.back();">{{ T "single.back" }}</a></span>&nbsp;|&nbsp;<span><a href="{{ .Site.Home.RelPermalink }}">{{ T "single.home" }}</a></span>
    </section>
  </div>

  <div class="post-nav">
    {{- with .PrevInSection -}}
      <a href="{{ .RelPermalink }}" class="post-nav-item" rel="prev" title="{{ .Title }}">
        {{- dict "Class" "fa-solid fa-angle-left fa-fw" | partial "plugin/icon.html" -}}
        {{- .Title -}}
      </a>
    {{- end -}}
    {{ with .NextInSection }}
      <a href="{{ .RelPermalink }}" class="post-nav-item" rel="next" title="{{ .Title }}">
        {{- .Title -}}
        {{- dict "Class" "fa-solid fa-angle-right fa-fw" | partial "plugin/icon.html" -}}
      </a>
    {{- end -}}
  </div>
</div>
